package com.anolesoft.amljmes.perm.controller.token;

import com.anolesoft.amljmes.perm.dto.userMenu.UiResourceDO;
import com.anolesoft.common.security.service.SysLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
@RestController
@CrossOrigin
@RequestMapping(value="/mesLogin")
public class TokenController {

    @Autowired
    private SysLoginService sysLoginService;

    /**
     * post请求登录注册,mes开具合格证时用
     * @return
     */
    @PostMapping(value = "/Login",produces = MediaType.APPLICATION_JSON_VALUE)
    public String postRegisterLogin(UiResourceDO uiResourceDO) throws Exception{
        // 获取到传递的人员eid，并根据eid查询当前登录人的用户名
        String userName = uiResourceDO.getName();
        String password = uiResourceDO.getPassword();
        String code = "3";
        String uuid = "4";
        String fhz = sysLoginService.login(userName,password,code,uuid);
        return fhz;
    }

}
